# -*- coding: utf-8 -*-
# @Time : 2021/12/29 20:02
# @Author : Limusen
# @File : demo_father_son


from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()

driver.get("https://www.baidu.com")


# 执行这个语句会报错
# driver.find_element(By.XPATH,'//*[@id="form"]/span[1]').send_keys("ssdasd")
# 　执行这个语句不会报错
# driver.find_element(By.XPATH,'//*[@id="kw"]').send_keys("ssdasd")

# 根据层级关系查找
driver.find_element_by_css_selector("span.bg.s_ipt_wr.new-pmd.quickdelete-wrap").find_element_by_id(
    "kw").send_keys("还傻傻")


